#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "rtspctrl.h"
#include <thread>
#include <condition_variable>
#include <mutex>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    enum ThreadState{
        IDLE_STATE=0,
        CACULATE_STATE
    };
    Q_ENUM(ThreadState)
protected:
    void OnInitDialog();
private:
    void InitSlot();
    void InitThread();
    void InitUI();
private:
    Ui::MainWindow *ui;
    RtspCtrl* m_rtsp{};
    std::thread m_work_thread;
    bool m_exit{false};
    std::condition_variable m_cv;
    std::mutex m_cv_mutex;
    bool m_connect{false};
    ThreadState m_state{ThreadState::IDLE_STATE};
};
#endif // MAINWINDOW_H
